package csw;

import java.util.Scanner;

public class J10SungJuk {
	//return을 이용한 메서드
	//주의 : Scanner  클래스를 이용해서 입력처리하고
	//	    close()를 하게 되면 다시 Scanner 생성 불가
	public static void main(String[] args) {
		String name;
		int kor = 0, eng = 0, mat = 0;
		int tot = 0;
		double avg = 0;
		char grd;
		
		name = inputName(makeScanner());
		kor = inputKor(makeScanner());
		eng = inputEng(makeScanner());
		mat = inputMat(makeScanner());
		tot = getTotal(kor, eng, mat);
		avg = getAverage(tot);
		grd = getGrade(avg);
		
		
		System.out.println(name);
		System.out.println(kor);
		System.out.println(eng);
		System.out.println(mat);
		System.out.println(tot);
		System.out.println(avg);
		
		
	}//main

	public static int inputMat(Scanner sc) {
		int mat;
		System.out.println("수학");
		mat = sc.nextInt();
		
		return mat;
	}

	public static int inputEng(Scanner sc) {
		int eng;
		System.out.println("영어");
		eng = sc.nextInt();
		
		return eng;
		
	}

	public static int inputKor(Scanner sc) {
		int kor;
		System.out.println("국어");
		kor = sc.nextInt();

		return kor;
	}

	public static String inputName(Scanner sc) {
		String name;

		System.out.println("이름은?");
		name = sc.next();
		return name;
	}

	public static int inputSungJuk(int kor, int eng, int mat) {
		
		Scanner sc = new Scanner(System.in);
		System.out.println("국어");
		kor = sc.nextInt();
		System.out.println("영어");
		eng = sc.nextInt();
		System.out.println("수학");
		mat = sc.nextInt();	
		
		return 0;
	
	}

	//Scanner생성
	public static Scanner makeScanner(){
		Scanner sc = new Scanner(System.in);
		return sc;
	}
	//Scanner소멸
	public static void closeScanner(
			Scanner sc){
		sc.close();
	}
	public static char getGrade(double avg) {
		char grd;
		switch ((int) avg / 10) {
		case 10:
		case 9:
			grd = '수';
			break;
		case 8:
			grd = '우';
			break;
		case 7:
			grd = '미';
			break;
		case 6:
			grd = '양';           
			break;
		default:
			grd = '가';
		
		}
		return grd;
	}

	public static double getAverage(int tot) {
		double avg;
		avg = (double)tot/3;
		return avg;
	}

	public static int getTotal(int kor, int eng, int mat) {
		int tot;
		tot = kor + eng + mat;
		return tot;
	}

}
